#include <iostream>
#include <vector>

using namespace std;

void bubbleSort(int arr[],int len) {
    if (arr == nullptr || len < 2) {
        return;
    }
    for (int end = len -1; end > 0; --end) {
        for (int i = 0;i < end;++i) {
            if (arr[i] > arr[i+1]){
                std::swap(arr[i],arr[i+1]);
            }
        }
    }
}
void selectionSort(int arr[],int len) {
    if (arr == nullptr || len < 2) {
        return;
    }
    for (int i = 0;i < len -1;++i) {
        int minIndex = i;
        for (int j = i+1;j<len; ++j) {
            minIndex = arr[j] < arr[minIndex]? j:minIndex;
        }
        std::swap(arr[minIndex],arr[i]);
    }
}

void insertionSort(int arr[],int len) {
    if (arr == nullptr || len < 2) {
        return;
    }
    for (int i = 1; i<len;++i){
        for (int j=i-1; j>=0 && arr[j]> arr[j+1];j--) {
            std::swap(arr[j],arr[j+1]);
        }
    }
}